package d1_com.itheima.thread;

public class Test {
    public static void main(String[] args) throws Exception {
        MyThread t = new MyThread("1号线程");
        t.start();
        t.join();//保证t先跑完

        MyThread t2 = new MyThread("2号线程");
        t2.start();

        Thread m = Thread.currentThread();
        m.setName("主线程");

        for (int i = 0; i < 5; i++) {
            System.out.println(m.getName() + "输出" + i);
            if (i == 2) {
                Thread.sleep(5000);
            }
        }

    }
}
